package com.itheima.mythread.Demo10;


import java.util.concurrent.ArrayBlockingQueue;

public class Cooker extends Thread {
    private ArrayBlockingQueue<String> bd;

    public Cooker(ArrayBlockingQueue<String> bd) {
        this.bd = bd;
    }

    @Override
    public void run() {
        int count = 0;
        while (true) {
            if (count>=8){
                break;
            }
            try {
                bd.put("汉堡包");
                count++;
                System.out.println("厨师放进去一个汉堡包");

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
